home *** CD-ROM | disk | FTP | other *** search
- #ifndef FWAROPER_H
- #define FWAROPER_H
- //========================================================================================
- //
- // File: FWArOper.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWARDYNA_H
- #include "FWArDyna.h"
- #endif
-
- #ifndef SOM_SOMObject_xh
- //MOVE THIS INCLUDE AND THE DEFINITION OF FW_SomCast to a .cpp file
- #include <somobj.xh>
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //----------------------------------------------------------------------------------------
- // FW_READ_DYNAMIC_OBJECT
- //
- // Global function for reading from a readableStream. The type 'className'
- // must be a dynamic class or a compile-time error will occur.
- //----------------------------------------------------------------------------------------
-
- #define FW_READ_DYNAMIC_OBJECT(archive, object, className) \
- { \
- className** _temp_ = object; \
- FW_CDynamicArchiver::InputObject(archive, (void *&)(*_temp_)); \
- *(object) = FW_DYNAMIC_CAST(className, *_temp_); \
- }
-
-
-
- //----------------------------------------------------------------------------------------
- // FW_WRITE_DYNAMIC_OBJECT
- //
- // Global function for writing to a writableStream. The type 'className' must
- // must be a dynamic class or a compile-time error will occur.
- //----------------------------------------------------------------------------------------
-
- #define FW_WRITE_DYNAMIC_OBJECT(archive, object, className) \
- { \
- const className* _temp_ = object; \
- FW_CDynamicArchiver::OutputObject(archive, _temp_, FW_CLASSNAME_FROM_POINTER(_temp_)); \
- }
-
- //----------------------------------------------------------------------------------------
- // FW_READ_DYNAMIC_SOM_OBJECT
- //
- // Global function for reading from a readableStream. The type 'className'
- // must be a dynamic class or a compile-time error will occur.
- //----------------------------------------------------------------------------------------
-
- inline SOMObject* FW_SomCast( SOMObject *object, SOMClass *className )
- {
- FW_ASSERT(somIsObj(object));
- FW_ASSERT(somIsObj(className));
- return object->somIsA(className) ? object : 0;
- }
-
- #define FW_READ_DYNAMIC_SOM_OBJECT(archive, object, className) \
- { \
- className** _temp_ = object; \
- FW_CDynamicArchiver::InputObject(archive, (void *&)(*_temp_)); \
- *(object) = (className*)FW_SomCast(*_temp_,className##ClassData.classObject); \
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_WRITE_DYNAMIC_SOM_OBJECT
- //
- // Global template function for writing to a writableStream. The type 'className' must
- // must be a dynamic class or a compile-time error will occur.
- //----------------------------------------------------------------------------------------
-
- #define FW_WRITE_DYNAMIC_SOM_OBJECT(archive, object, className) \
- { \
- className* _temp_ = object; \
- FW_CDynamicArchiver::OutputObject(archive, _temp_, _temp_->somGetClassName()); \
- }
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-